package com.jpsl.core.items;

import java.util.function.Supplier;

/**
 * if 条件
 *
 * @param <E>
 * @param <ES>
 * @author 懒王猫
 */
public final class If<E, ES extends Items<E>> {

    private final Branches<E> branches;
    
    /** if条件 */
    private final Condition condition;

    /** dsl 选项集 */
    private final ES es;

    If(Branches<E> branches, Condition condition, ES predicates) {
        this.branches = branches;
        this.condition = condition;
        es = predicates;
    }

    public Then<E, ES> $then(Supplier<E> supplier) {
        return new Then<>(branches.add(condition, supplier), es);
    }

}
